package com.huike;

import com.huike.clues.service.ITbActivityService;
import com.huike.clues.service.impl.SysDictTypeServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;

import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.scheduling.annotation.EnableScheduling;

/**
 * 启动程序
 * 
 * 
 */
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class})
@EnableScheduling
public class HuiKeApplication /*implements CommandLineRunner */{

    @Autowired
    private ITbActivityService activityService;

    public static void main(String[] args){
        SpringApplication.run(HuiKeApplication.class, args);
    }

    //这里由于ActivityCode是随机生成的,为了防止重复的ActivityCode,提前将ActivityCode加在到redis缓存中了,为了后续判断有无重复
    /* 优化:我们用UUID的工具类生成8位不会重复的随机数,因此不在需要启动时加载redis缓存中数据 */
    /* 启动类最好不要加其他逻辑,最好放到其他类里 ,这里将这段代码移动到runner包下*/
//    @Override
//    public void run(String... args)  {
//        try{
//            //加载所有活动code到缓存
//            activityService.loadAllActivityCode();
//        }catch (Exception ex){
//            ex.printStackTrace();
//        }
//    }
}

